#include<stdio.h>
int main()
{
	int i = 0;
	int arr1[7] = { 0 };
	int arr2[7] = { 0 };
	for (i = 0; i < 7; i++)
	{
		scanf("%d %d", &arr1[i], &arr2[i]);
	}
	int sum[7] = { 0 };
	for (i = 0; i < 7; i++)
	{
		sum[i] = (arr1[i] + arr2[i]);
	}
	int max = sum[0];
	int j = 0;
	for (i = 0; i < 7; i++)
	{
		if (sum[i] > max)
		{
			max = sum[i];
			j = i;
		}
	}
	if (max <= 8)
	{
		printf("%d", 0);
	}
	else
	{
		printf("%d", j + 1);
	}
	return 0;
}






#include<stdio.h>
int main()
{
	int l = 0;
	int m = 0;
	scanf("%d %d", &l, &m);
	int i = 0;
	int arru[100] = { 0 };
	int arrv[100] = { 0 };
	for (i = 0; i < m; i++)
	{
		scanf("%d %d", &arru[i], &arrv[i]);
	}
	int arr[10000] = { 0 };
	for (i = 0; i < m; i++)
	{
		int j = 0;
		for (j = 0; (arru[i] + j) <= arrv[i]; j++)
		{
			arr[arru[i] + j] = 1;
		}
	}
	int count = 0;
	for (i = 0; i <= l; i++)
	{
		if (arr[i] == 0)
		{
			count++;
		}
	}
	printf("%d", count);
	return 0;
}